package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

/**
 * 描述：无序的流forEach
 */
public class ForEach {
    static final int size = 14;

    public static void main(String[] args) {
        RandInts.rands()
                .limit(size)
                .forEach(n -> System.out.format("%d ", n));
        System.out.println();
        RandInts.rands()
                .limit(size)
                //并行，顺序也因此被打乱了
                .parallel()
                .forEach(n -> System.out.format("%d ", n));
        System.out.println();
        RandInts.rands()
                .limit(size)
                .parallel()
                .forEachOrdered(n -> System.out.format("%d ", n));
    }
}
